using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Week1.world
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class SpaceDome : DrawableBase
    {

        const int SCALE = 10;

        public SpaceDome(Game game, string modelname, player.Camera camera, Effect effect)
            : base(game, modelname, camera, effect, 1)
        {
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            oVars.iInstanceCount = 1;
            oVars.oPosition[0] = oVars.oCamera.Position;
            oVars.oWorld[0] = Matrix.CreateScale(SCALE) * Matrix.CreateWorld(oVars.oPosition[0], Vector3.Forward, Vector3.Up);

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            oVars.oPosition[0] = oVars.oCamera.Position;

            oVars.oWorld[0].M11 = SCALE;
            oVars.oWorld[0].M41 = oVars.oPosition[0].X;
            oVars.oWorld[0].M42 = oVars.oPosition[0].Y;
            oVars.oWorld[0].M43 = oVars.oPosition[0].Z;

            base.Update(gameTime);
        }
    }
}
